﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text;
using Maticsoft.DBUtility;
using EnvironmentManagerSystem.MODE;
using MySql.Data.MySqlClient;

namespace EnvironmentManagerSystem.A
{
    public partial class ShouLiRen : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.DataSource = GetList();
                DropDownList1.DataTextField = "hesuanren";
                DropDownList1.DataBind();
                DropDownList1.Items.Insert(0, new ListItem("请选择", "请选择"));
            }
        }

        #region 查询核算人
        public static DataTable GetList()
        {
            try
            {
                StringBuilder br = new StringBuilder();
                br.Append(" SELECT hesuanren FROM tbs001_developprojectbasicinfo WHERE hesuanren != '' GROUP BY hesuanren");
                return DbHelperMySQL.Query(br.ToString()).Tables[0];
            }
            catch { return null; }
        }
        #endregion

        #region 按钮(搜索按钮、重置按钮)(x)
        //搜索按钮
        protected void Button1_Click(object sender, EventArgs e)
        {
            string url;
            url = "ShouLiRens.aspx?HeSuanRen1=" + DropDownList1.SelectedValue;
            Response.Redirect(url);
        }
        //重置按钮
        protected void Button2_Click(object sender, EventArgs e)
        {
            foreach (Control con in this.form1.Controls)
            {
                if (con is DropDownList)
                    ((DropDownList)con).SelectedIndex = -1;
            }
        }
        #endregion
    }
}
